<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:pr="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:cc="http://java.sun.com/jsf/composite">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="orderBean" required="true"/>
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <h1 id="orderID"><h:outputText value="Order tracking number: #{cc.attrs.orderBean.trackingNumber}"/></h1>
            
               <h:form>
                <pr:dataTable id="items" value="#{cc.attrs.orderBean.entries}" var="invoiceEntry">

                    <pr:column sortBy="#{invoiceEntry.product.name}">
                        <f:facet name="header">
                            <h:outputText value="Product name"/>
                        </f:facet>
                        <h:outputText value="#{invoiceEntry.product.name}"/>
                    </pr:column>

                    <pr:column sortBy="#{invoiceEntry.quantity}">
                        <f:facet name="header">
                            <h:outputText value="Quantity"/>
                        </f:facet>
                        <h:outputText value="#{invoiceEntry.quantity}"/>
                    </pr:column>


                    <pr:column sortBy="#{invoiceEntry.unitCost}">
                        <f:facet name="header">
                            <h:outputText value="Unit cost"/>
                        </f:facet>
                        <h:outputText value="#{invoiceEntry.unitCost}"/>
                    </pr:column>
                    
                    <pr:column sortBy="#{invoiceEntry.totalCost}">
                        <f:facet name="header">
                            <h:outputText value="Total cost"/>
                        </f:facet>
                        <h:outputText value="#{invoiceEntry.totalCost}"/>
                    </pr:column>
                </pr:dataTable>
            </h:form>
    </cc:implementation>
</html>